<div class="bjui-pageContent">
    <form action="{:U($Think.ACTION_NAME)}" id="addForm" class="pageForm" data-toggle="validate" data-reload-navtab="true">
        <input type="hidden" id="pk" name="info[id]" value="{$info.cid}">
        <table class="table table-condensed table-hover" width="100%">
            <tbody>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">标题：</label>
                    <input id="title" class="checktitle" type="text" name="info[title]" value="{$info.title}" size="60" data-rule="required" />
                    <a href="javascript:void(0)" id="checkNewsTitle">检测是否重复</a>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">起止时间：</label>
                    <input type="text" name="info[optime]" value="{$info.optime}" placeholder="请输入开始时间"  readonly="readonly" data-toggle="datepicker" size="10" data-rule="required" />
                    <input type="text" name="info[endtime]" value="{$info.endtime}" placeholder="请输入结束时间"  readonly="readonly" data-toggle="datepicker" size="10" data-rule="required" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">关键词：</label>
                    <input type="text" name="info[keywords]" value="{$info.keywords}" placeholder="多关键词间用半角逗号分开" size="60" data-rule="required" /> 多关键词间用半角逗号分开
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">置顶：</label>
                    <input type="radio" name="info[isTop]" value="1" data-toggle="icheck" data-rule="required" data-label="是&nbsp;&nbsp;&nbsp;" <if condition="$info.isTop eq 1">checked</if> />
                    <input type="radio" name="info[isTop]" value="0" data-toggle="icheck" data-rule="required" data-rule="checked" data-label="否&nbsp;&nbsp;&nbsp;" <if condition="$info.isTop eq 0">checked</if> />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">文章描述：</label>
                    <textarea name="info[description]" style="width:784px;height:50px" data-toggle="autoheight" data-rule="required">{$info.description}</textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">文章摘要：</label>
                    <textarea name="info[summary]" style="width:784px;height:50px" data-toggle="autoheight" data-rule="required">{$info.summary}</textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">活动封面图：</label>
                    <input type="text" id="thumbnail_text" name="info[img]" readonly="readonly" value="{$info.img}" size="60" data-rule="required" data-msgClass="n-bottom"/>
                    <input type="button" id="thumbnail_btn" class="btn btn-info" value="选择图片" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">文章内容：</label>
                    <div style="display: inline-block; vertical-align: middle;">
                        <textarea name="info[content]" style="width:784px;height:50px" data-toggle="kindeditor" data-rule="required">{$info.content}</textarea>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>

<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
    </ul>
</div>

<script type="text/javascript">
    // 单独调用KindEditor图片插件
    var editor = KindEditor.editor({
        allowFileManager : true
    });
    KindEditor('#thumbnail_btn').click(function() {
        editor.loadPlugin('image', function() {
            editor.plugin.imageDialog({
                imageUrl : KindEditor('#url1').val(),
                clickFn : function(url, title, width, height, border, align) {
                    KindEditor('#thumbnail_text').val(url);
                    editor.hideDialog();
                }
            });
        });
    });

    //@author-tc
    // 检查标题是否重复
    $("#checkNewsTitle").blur(function() {
        $.getJSON("__URL__/checkArticleTitle", {
            title: $("#title").val(),
            id: "{$info.cid}"
        }, function(json) {
            $("#checkNewsTitle").css("color", json.statusCode == 200 ? "#0f0" : "#f00").html(json.message);
        });
    });
    $(".checktitle").blur(function() {
        $.getJSON("__URL__/checkArticleTitle", {
            title: $("#title").val(),
            id: "{$info.cid}"
        }, function(json) {
            $("#checkNewsTitle").css("color", json.statusCode == 200 ? "#0f0" : "#f00").html(json.message);
        });
    });
    //@author-tc
</script>